import sys
sys.path.append("..")
from Core.Plugins.Gernel import * 
from PyQt4 import QtCore, QtGui


g_section = ["FileName", "FileType", "Tav_VirusName"]

class GernelModel(QtCore.QAbstractTableModel):
    def __init__(self, parent = None):
        QtCore.QAbstractTableModel.__init__(self, parent)
        self.gernel_data = GernelPlugin.Instance().GetData();
        

    def rowCount(self, parent = QtCore.QModelIndex()):
        return len(self.gernel_data)
    
    def columnCount(self, parent = QtCore.QModelIndex()):
        return len(g_section)
    
    def data(self, index, role = QtCore.Qt.DisplayRole):
        if (role == QtCore.Qt.DisplayRole):
            i = 0
            for value in self.gernel_data.items():
                if not (i == index.row()):
                    i = i + 1
                    continue
                return value.file_name
                    
            
            
    def headerData(self, section, orientation, role = QtCore.Qt.DisplayRole):
        if (role == QtCore.Qt.DisplayRole and orientation == QtCore.Qt.Horizontal):
            return g_section[section]
        